﻿using RepositoryDefinition;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ForumBL
{
    public class PostBL
    {
        IPostRepository postContext;
        public PostBL()
        {
            postContext = IOC.Factory.GetRepository().GetPostRepository();
        }

        public List<ForumDomainModels.Post> GetPostsByCategory(ForumDomainModels.Category category)
        {
            List<ForumDomainModels.Post> posts = postContext.GetPostsByCategory(category);
            return posts;
        }

        public int GetPostCountByCategory(ForumDomainModels.Category category)
        {   
            int postCount = postContext.GetPostCountByCategory(category);
            return postCount;
        }

        public void InsertPost(ForumDomainModels.Post post)
        {
            postContext.InsertPost(post);
        }

        public ForumDomainModels.Post GetPostById(ForumDomainModels.Post post)
        {
            post = postContext.GetPostById(post);
            return post;
        }
    }
}
